class Storage {
    static setUser(user) {
        sessionStorage.setItem("user", JSON.stringify(user));
    }

    static getUser() {
        let user = sessionStorage.getItem("user");
        if (user != null) return JSON.parse(user);
        return null;
    }

    static removeObject(key) {
        sessionStorage.removeItem(key);
    }

    static setObject(key, value) {
        sessionStorage.setItem(key, JSON.stringify(value));
    }

    static getObject(key) {
        let obj = sessionStorage.getItem(key);
        if (obj != null) return JSON.parse(obj);
        return null;
    }

    static setLocalObject(key,value) {
        localStorage.setItem(key, JSON.stringify(value));
    }

    static getLocalObject(key) {
        let obj = localStorage.getItem(key);
        if (obj != null) return JSON.parse(obj);
        return null;
    }

    static removeLocalObject(key) {
        localStorage.removeItem(key);
    }
}
export default Storage;